<!DOCTYPE html>
<html>

<head>
    <title></title>
    <meta charset="utf-8">
    <!-- 最新 Bootstrap 核心 CSS 文件 -->
    <link rel="stylesheet" href="http://cdn.bootcss.com/twitter-bootstrap/3.0.3/css/bootstrap.min.css">

    <!-- 可选的Bootstrap主题文件（一般不用引入） -->
    <link rel="stylesheet" href="http://cdn.bootcss.com/twitter-bootstrap/3.0.3/css/bootstrap-theme.min.css">

    <!-- jQuery文件。务必在bootstrap.min.js 之前引入 -->
    <script src="http://cdn.bootcss.com/jquery/1.10.2/jquery.min.js"></script>

    <!-- 最新的 Bootstrap 核心 JavaScript 文件 -->
    <script src="http://cdn.bootcss.com/twitter-bootstrap/3.0.3/js/bootstrap.min.js"></script>
    <!-- 自己服务器上的markdown的js文件 -->
    <script src="http://47.94.165.122/MarkdownIME.js"></script>
    <script src="http://47.94.165.122/showdown.min.js"></script>
    <style media="screen">
        .shadow {
            position: fixed;
            left: 0;
            top: 0;
            width: 100%;
            height: 100%;
            background: #000;
            opacity: 0.3;
            filter: alpha(opacity=30);
        }

        .mod_dialog {
            position: fixed;
            left: 0%;
            top: 0%;
            width: 100%;
            height: 100%;
            background: #fff;
        }
    </style>
    <script>
        function compile() {
            var text = document.getElementById("content").value;
            var converter = new showdown.Converter();
            var html = converter.makeHtml(text);
            document.getElementById("result").innerHTML = html;
        }
    </script>
</head>

<body>
    <div class="page">
        <ul class="nav nav-tabs">
            <li>
                <a href="/admin/">管理首页</a>
            </li>
            <li>
                <a href="/admin/banners">banner设置</a>
            </li>
            <li>
                <a href="/admin/images">images上传</a>
            </li>
            <li>
                <a href="/admin/news">公司新闻</a>
            </li>
            <li>
                <a href="/admin/contact">联系方式</a>
            </li>
            <li>
                <a href="/admin/msg">留言管理</a>
            </li>
            <li>
                <a href="/admin/companyInfor">公司简介</a>
            </li>
            <li>
                <a href="/admin/headDescription">公司公告</a>
            </li>
            <li>
                <a href="/admin/companyHistory">公司历程</a>
            </li>
            <li class="active">
                <a href="/admin/industryconsulting">行业咨询</a>
            </li>
            <li>
                <a href="/admin/partners">合作伙伴</a>
            </li>
            <li>
                <a href="/admin/product">产品服务</a>
            </li>
            <li>
                <a href="/admin/map">自定义地图</a>
            </li>
            <li>
                <a href="/admin/navname">一级导航名</a>
            </li>
        </ul>
        <div class="content-wrap">
            <div>
                <form action="?" method="post" enctype="multipart/form-data" role="form">
                    <label for="leixing"> 类型：</label>
                    <input type="text" name="leixing" id="leixing" class="form-control" placeholder="company代表公司新闻，other代表行业新闻" />
                    <label for="title"> 标题：</label>
                    <input type="text" name="title" id="title" class="form-control" placeholder="请输入标题" />
                    <label for="second_title"> 副标题：</label>
                    <textarea name="second_title" id="second_title" class="form-control" rows="5" placeholder="输入副标题"></textarea>
                    <!-- <label for="f1"> 封面图片：</label>
                    <input type="file" name="url" id="f1" placeholder="选择文件" /> -->
                    <label for="content"> 内容：</label>
                    <textarea id="content" name="content" class="form-control" rows="10" onkeyup="compile()"></textarea>
                    <div id="result"></div>
                    <label for="post_time">发表时间</label>
                    <input type="date" name="post_time" id="post_time" >
                    <label for="author"> 作者：</label>
                    <input type="text" name="author" id="author" class="form-contrl" />
                    <br>
                    <button type="submit" class="btn btn-default">添加</button>
                </form>
            </div>
            <table class="table table-striped table-bordered table-hover container-fluid" style="table-layout:fixed">
                <thead class="row">
                    <tr>
                        <th class="col-md-1">ID</th>
                        <th class="col-md-1">类型</th>
                        <th class="col-md-1">标题</th>
                        <th class="col-md-2">副标题</th>
                        <!-- <th class="col-md-1">图片</th> -->
                        <th class="col-md-5">内容</th>
                        <th class="col-md-1">作者</th>
                        <th class="col-md-1">操作</th>
                    </tr>
                </thead>
                <tbody class="row">
                    <% for(var i=0;i<industryconsultingdata.length;i++){ %>
                        <tr>
                            <td>
                                <%=industryconsultingdata[i].ID%>
                            </td>
                            <td>
                                <%=industryconsultingdata[i].type%>
                            </td>
                            <td>
                                <%=industryconsultingdata[i].title%>
                            </td>
                            <td>
                                <%=industryconsultingdata[i].second_title%>
                            </td>
                            <!-- <td>
                                <img width="160px" src="/upload/<%=industryconsultingdata[i].url%>" />
                            </td> -->
                            <td style="overflow:hidden;white-space:nowrap;text-overflow:ellipsis;">
                                <%=industryconsultingdata[i].content%>
                            </td>

                            <td>
                                <%=industryconsultingdata[i].author%>
                            </td>
                            <td>
                                <a class="btn btn-warning" href="?act=mod&id=<%=industryconsultingdata[i].ID%>">修改</a>
                                <a class="btn btn-danger" href="?act=del&id=<%=industryconsultingdata[i].ID%>" onclick="return confirm('你真的要删吗？')">删除</a>
                            </td>
                        </tr>
                        <% } %>
                </tbody>
            </table>
            <% if(typeof mod_data!='undefined'){ %>
                <div class="shadow"></div>
                <div class="mod_dialog">
                    <form action="?" method="post" enctype="multipart/form-data">
                        <input type="hidden" name="mod_id" value="<%= mod_data.ID %>" />
                        <label for="leixingchange"> 类型：</label>
                        <input type="text" id="leixingchange" name="leixing" class="form-control" value="<%= mod_data.type %>" />
                        <label for="titlechange"> 标题：</label>
                        <input type="text" id="titlechange" name="title" class="form-control" value="<%= mod_data.title %>" />
                        <label for="second_title"> 副标题：</label>
                        <textarea name="second_title" id="second_title" class="form-control" rows="5"><%= mod_data.second_title %></textarea>
                        <!-- <label for="url"> 封面图片：</label>
                        <input type="file" name="url" id="url" class="form-control" /> -->
                        <label for="content"> 内容：</label>
                        <textarea name="content" id="content" class="form-control" rows="10"><%= mod_data.content %></textarea>
                        <br>
                        <label for="post_time">发表时间</label>
                        <input type="date" name="post_time"  value="<%= mod_data.post_time %>">
                        <label for="authorchange"> 作者：</label>
                        <input type="text" name="author" id="authorchange"value="<%= mod_data.author %>"/>
                        <br>
                        <input class="btn btn-danger" type="submit" value="修改" />
                        <a class="btn btn-warning" href="/admin/industryconsulting">取消修改</a>
                        
                    </form>
                </div>
                <% } %>
        </div>
    </div>
</body>

</html>